import axios from "axios";

const instance = axios.create({
  baseURL: "https://s1.eqxiu.com/eqs/s/scene/count?code=qAD55qYS",
  timeout: 5000,
});

// 添加请求拦截器
instance.interceptors.request.use(
  function (config) {
    console.log(config)
    config.cookie='_tracker_distinct_id_=2021122296bed8ef; _tracker_launch_=1; _tracker_share_level_=2; _tracker_from_user_=20211221575d6b66; _tracker_from_id_=b03d9639-1; _tracker_session_id_=94c6c9ae-b956-4b94-9f74-9bd8fd4acc48; log_session_id=e7709b5a-4409-41cb-bfd9-1053d9db1381'
    // 在发送请求之前做些什么
    return config;
  },
  function (error) {
    // 对请求错误做些什么
    return Promise.reject(error);
  }
);

// 添加响应拦截器
instance.interceptors.response.use(
  function (response) {
    return response.data;
  },
  function (error) {
    // 对响应错误做点什么
    return Promise.reject(error);
  }
);

export default instance;
